package DataStructrue.queue;

public interface MyQueue<E> {
    E first();

    E last();

    void push(E e);

    E poll();

    int size();

    boolean isEmpty();

    void clear();

//SeqQueue{e=[0,1,2,3,4,5,6,7,8,9], head=0, tail=9}
//0
//1
//2
//3
//4
//SeqQueue{e=[5,6,7,8,9], head=5, tail=9}
//SeqQueue{e=[100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119], head=0, tail=19}
//100
//119

    public static void main(String[] args) {
        MyQueue<Integer> q=new LinkQueue<>();
        for (int i = 0; i < 10; i++) {
            q.push(i);
        }
        System.out.println(q);
        for (int i = 0; i < 5; i++) {
            System.out.println(q.poll());
        }
        System.out.println(q);
        for (int i = 0; i < 10; i++) {
            q.poll();
        }
        for (int i = 0; i < 20; i++) {
            q.push(i+100);
        }
        System.out.println(q);
        System.out.println(q.first());
        System.out.println(q.last());
    }
}
